<!DOCTYPE html>
<html>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>doh.robot MVC search-results-repeat Test</title>

		<style>
			@import "../../../../../util/doh/robot/robot.css";
		</style>

		<!-- required: dojo.js -->
		<script type="text/javascript" src="../../../../../dojo/dojo.js"
			djConfig="isDebug: true, parseOnLoad: true"></script>

		<script type="text/javascript" src="../helpers.js"></script>

		<script type="text/javascript">
			dojo.require("dijit.robotx");

			dojo.addOnLoad(function(){
				doh.robot.initRobot('../test_mvc_search-results-repeat.html');

				doh.register("on_test_MVC_Search_Results_Repeat", [
					 {
						name: "initial conditions",
						timeout: 9000,
						runTest: function(){
						var d = new doh.Deferred();
						console.debug("dojo.version() is "+dojo.version);
						
						doh.robot.sequence(d.getTestCallback(function(){
							doh.is("Anne", dijit.byId("nameInput0").get('value'),"nameInput0 should be set");
							doh.is("Ben", dijit.byId("nameInput1").get('value'),"nameInput1 should be set");
							doh.is("John", dijit.byId("nameInput9").get('value'),"nameInput9 should be set");
							doh.is("Anne", dijit.byId("firstInput").get('value'),"firstInput should be set");
							doh.is("Ackerman", dijit.byId("lastInput").get('value'),"lastInput should be set");
							doh.is("a.a@test.com", dijit.byId("emailInput").get('value'),"emailInput should be set");
						}), 1000);
						return d;
						}
					 },
					{
						name: "selectBen",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("dijit_form_Button_2", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("Ben", dijit.byId("firstInput").get('value'),"firstInput should be set");
								doh.is("Beckham", dijit.byId("lastInput").get('value'),"lastInput should be set");
								doh.is("b.b@test.com", dijit.byId("emailInput").get('value'),"emailInput should be set");
							}), 1000);
							return d;
						}
					},
					{
						name: "selectJohn",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("dijit_form_Button_10", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("John", dijit.byId("firstInput").get('value'),"firstInput should be set");
								doh.is("Jacklin", dijit.byId("lastInput").get('value'),"lastInput should be set");
								doh.is("j.j@test.com", dijit.byId("emailInput").get('value'),"emailInput should be set");
							}), 1500);
							return d;
						}
					},
					{
						name: "changeJohn",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("firstInput", 500, 0);
							doh.robot.mouseClick({left:true}, 500);

							doh.robot.keyPress(dojo.keys.BACKSPACE, 500, {});						  
							doh.robot.keyPress(dojo.keys.BACKSPACE, 200, {});						  
							doh.robot.keyPress(dojo.keys.BACKSPACE, 200, {});						  
							doh.robot.keyPress(dojo.keys.BACKSPACE, 200, {});						  
							doh.robot.typeKeys("Johnny", 1000, 2000);													  
							doh.robot.keyPress(dojo.keys.TAB, 500, {});							
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("Johnny", dijit.byId("firstInput").get('value'),"firstInput should be set");
								doh.is("Johnny", dijit.byId("nameInput9").get('value'),"nameInput9 should be set");
							}), 1000);
							return d;
						}
					},
					{
						name: "changeBen",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("dijit_form_Button_2", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.mouseMoveAt("nameInput1", 500, 0);
							doh.robot.mouseClick({left:true}, 500);

							doh.robot.typeKeys("jamin", 500, 1000);														
							doh.robot.keyPress(dojo.keys.TAB, 500, {});							
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("Benjamin", dijit.byId("firstInput").get('value'),"firstInput should be set");
								doh.is("Benjamin", dijit.byId("nameInput1").get('value'),"nameInput1 should be set");
							}), 1000);
							return d;
						}
					}				]);
				doh.run();
			});
		</script>
</html>
